$(function () {
    init_record();
    back_to_front();
});

function init_record() {
    $.ajax({
        url: '/get-user-self-orders',
        type: 'get',
        dataType: 'json',
        success: function (data) {
            if (data.status) {
                var result_list = new Array(data.result);
                result_list.forEach((value, _idx, _arr) => {
                    value.forEach((sub_value, _sub_idx, _sub_arr) => {
                        $t_body = `
                        <tr>
                            <td>${sub_value['id']}</td>
                            <td>${sub_value['name']}</td>
                            <td>${sub_value['price']}</td>
                        </tr>
                        `;
                        $('#table-body').append($t_body);
                    });
                });
            } else {
                alert('数据获取失败');
            }
        } 
    }); 
}

function back_to_front () {
    $('#back-button').click(() => {
        window.location.href = '/page/user-message.html';
    });1
}